<?php
include 'admin_passport_action_lib.php';

$a_css_files = array (
    array ( 'path' => 'plugins/jquery-ui/jquery-ui-1.10.1.custom.min.css' ),
);

$a_js_files = array (
    array ( 'path' => 'plugins/jquery-validation/dist/jquery.validate.min.js' ),
    array ( 'path' => 'scripts/nh-admin-passport-action-form.js' ),
);

$a_js_class[] = 'Action_Form.init();';

if($s_Action == 'update'){
    
    if($f_actionid == ''){ raise_error('No ID.'); }

    $db_query  = db_get_query($a_tablecolumns_namhoa_passport_action);
    $db_query  = $db_query . " where actionid = '$f_actionid'";
    $db_result = db_query($db_conn, $db_query);
    
    if($d_passport_action = db_fetch($db_result)){
    }
    else{
        raise_error('Select None.');
    }
}

include 'lib_head.php';
?>
<!-- BEGIN PAGE CONTENT-->
<div class="row-fluid">
    <div class="span12">
        <!-- BEGIN SAMPLE FORM PORTLET-->   
        <div class="portlet box blue">
            <div class="portlet-title">
                <div class="caption">
                    <i class="icon-plus"></i>
                    <span class="hidden-480">Action</span>
                </div>
            </div>
            <div class="portlet-body form">
                <!-- BEGIN FORM-->
                <form action="admin_passport_action_execute.php" method="post" id="form-action" class="form-horizontal">
                    <div class="alert alert-error hide">
                        <button class="close" data-dismiss="alert"></button>
                        Kiểm tra lại thông tin bên dưới.
                    </div>
                    <div class="control-group">
                        <label class="control-label">Action ID <span class="required">*</span></label>
                        <div class="controls">
                            <input type="text" style="text-transform:uppercase;" name="actionid" value="<?= check_plain($d_passport_action->actionid) ?>" placeholder="Action ID" class="m-wrap" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Action Name <span class="required">*</span></label>
                        <div class="controls">
                            <input type="text" name="actionname" value="<?= check_plain($d_passport_action->actionname) ?>" placeholder="Action Name" class="m-wrap" />
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Action Status <span class="required">*</span></label>
                        <div class="controls">
                            <select name="actionstatus" class="m-wrap" tabindex="1">
                                <?php foreach($a_actionstatuses as $v_key){ ?>
                                <option value="<?= $v_key ?>" <?= $v_key == $d_passport_action->actionstatus ? ' selected="selected"' : ''?>><?= check_plain($v_key) ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">Note</label>
                        <div class="controls">
                            <textarea name="note" class="large m-wrap" rows="3"><?= check_plain($d_passport_action->note) ?></textarea>
                        </div>
                    </div>
                    <div class="form-actions">
                        <?= $s_InputString ?>
                        <input type="hidden" name="action" id="action" value="<?= check_plain($s_Action) ?>"/>
                        <button type="button" class="btn">Cancel</button>
                        <button type="submit" class="btn blue"><i class="icon-ok"></i> Save</button>
                    </div>
                </form>
                <!-- END FORM-->  
            </div>
        </div>
        <!-- END SAMPLE FORM PORTLET-->
    </div>
</div>
<!-- END PAGE CONTENT-->
<?php include 'lib_tail.php'; ?>